-content_for :modal_title do
  -if f.object.new_record?
    New
    ="#{f.object.type_name}" if f.object.type_name
    Request
  -else
    Edit request

-if !f.object.new_record?
  -content_for :modal_delete_path, delete_flow_request_path(f.object)

=f.hidden_field :pbc_list_id
=f.hidden_field :type_id

.row-fluid
  =wrapped_text_field f, :span3, :pbc_control_code, :placeholder => 'Control Code', :label_name => 'Control Code from PBC'
  .span3

  =wrapped_date_field f, :span2, :date_requested, :class => 'date', :placeholder => 'MM/DD/YYYY', :label_name => 'Date Requested', :value => f.object.date_requested.present? ? f.object.date_requested.strftime('%m/%d/%Y') : Time.zone.now.strftime('%m/%d/%Y')
  =wrapped_date_field f, :span2, :response_due_at, :class => 'date', :placeholder => 'MM/DD/YYYY', :label_name => 'Response Due Date', :value => f.object.response_due_at.present? ? f.object.response_due_at.strftime('%m/%d/%Y') : ""
  =wrapped_select f, :span2, :status, Request.statuses, :selected => (f.object.status), :label_name => 'Status of Request'

.row-fluid
  .span3.pbc-control-select
    %label gGRC Control Code
    
    %a.btn.btn-mini.pull-right{:href => flow_controls_path(:list_select => 1), :'data-toggle' => 'modal-ajax-single-selector', :'data-modal-reset' => 'reset', :'data-list-target' => '#referenceList', :'data-modal-class' => 'modal-wide' }
      %i.grcicon-link
    
    -control = f.object.control_assessment && f.object.control_assessment.control
    =hidden_field_tag "request[control_id]", control && control.id
    %span.item.i-control.has-link.oneline
      =control && control.slug || "".html_safe
  .span3
  =wrapped_text_field f, :span3, :company_responsible, :placeholder => 'Internal assignee', :label_name => 'Assignee'
  =wrapped_text_field f, :span3, :auditor_responsible, :placeholder => 'Auditor contact email', :label_name => 'Auditor Contact'

.row-fluid
  =wrapped_text_area f, :span6, :pbc_control_desc, :class => 'double wysihtml5', :placeholder => 'Enter description here', :wrapper_div_class => 'wysiwyg-area', :label_name => 'Control Description from PBC List'
  =wrapped_text_area f, :span6, :request, :class => 'double wysihtml5', :placeholder => 'Enter request here', :wrapper_div_class => 'wysiwyg-area', :label_name => 'Request <span class="required">*</span>'.html_safe
.row-fluid
  =wrapped_text_area f, :span6, :notes, :class => 'double wysihtml5', :placeholder => 'Enter notes here', :wrapper_div_class => 'wysiwyg-area'
  =wrapped_text_area f, :span6, :test, :class => 'double wysihtml5', :placeholder => 'Enter test here', :wrapper_div_class => 'wysiwyg-area'

%br

=render :partial => "shared/wysihtml5"
